package com.yunhe.energy.client;

import com.yunhe.common.model.ResultObject;
import com.yunhe.common.model.device.Analog;
import com.yunhe.energy.client.fallback.DeviceFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import springfox.documentation.annotations.ApiIgnore;

/**
 * @author hetao
 */
@ApiIgnore
@FeignClient(value = "yh-device", fallbackFactory = DeviceFallbackFactory.class)
@Component
public interface DeviceClient {

    /**
     * @Author HeTao
     * @Description //根据设备代码和点号类型代码和端子获得点表列表
     * @Date 17:02 2020/10/13
     * @Param [devCode, typeCode, terminal]
     * @return org.springframework.http.ResponseEntity<com.yunhe.common.model.ResultObject<com.yunhe.common.model.device.Analog>>
     **/
    @RequestMapping(value = "/analogs/byDevAndType", method = RequestMethod.GET)
    ResponseEntity<ResultObject<Analog>> getAnalogsByDevCodeAndTypeCode(@RequestParam("devCode") Long devCode,
                                                                        @RequestParam("typeCode") String typeCode,
                                                                        @RequestParam("terminal") String terminal,
                                                                        @RequestParam("meter") String meter);

    /**
     * @Author HeTao
     * @Description //根据设备代码和点号类型代码和端子获得点表列表
     * @Date 17:02 2020/10/13
     * @Param [devId, typeCode, terminal,meter]
     * @return org.springframework.http.ResponseEntity<com.yunhe.common.model.ResultObject<com.yunhe.common.model.device.Analog>>
     **/
    @RequestMapping(value = "/analogs/byDevIdAndTypeCode", method = RequestMethod.GET)
    ResponseEntity<ResultObject<Analog>> getAnalogsByDevIdAndTypeCode(@RequestParam("devId") Long devId,
                                                                      @RequestParam("typeCode") String typeCode,
                                                                      @RequestParam("terminal") String terminal,
                                                                      @RequestParam("meter") String meter);
}
